{% extends "base_blank.volt" %}

{% block pageFooter%}
    {{ javascript_include("/assets/manage/js/question/listAnswer.js", false) }}
{% endblock %}

{% block content %}
    <div class="container-fluid" id="content_box_blank">
        <div class="row">
            <div class="col-xs-12">
                <ol class="breadcrumb">
                    <li>问答</li>
                    <li class="active">问答管理</li>
                    <li class="active">回答列表</li>
                </ol>

                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th style="width: 60px;">ID</th>
                        <th style="width: 160px;">用户</th>
                        <th>回答内容</th>
                        <th style="width: 60px;">赞</th>
                        <th style="width: 60px;">状态</th>
                        <th style="width: 150px;">时间</th>
                        <th style="width: 120px;"></th>
                    </tr>
                    </thead>
                    {% for d in data %}
                        <tr>
                            <td>{{ d['answer_id'] }}</td>
                            <td>{{ d['user_nickname'] }}</td>
                            <td>{{ d['answer_content']|e }}
                                <div class="question_photos_box">
                                    {% for pic in json_decode(d['answer_pics']) %}
                                    <div class="pic_list">
                                        <a href="{{ PicUrlQuestion(pic, this.getDi()) }}" class="thumbnail" target="_blank">
                                            <img src="{{ PicUrlQuestion(pic, this.getDi()) }}@!120" alt="" />
                                        </a>
                                    </div>
                                    {% endfor %}
                                </div>
                            </td>
                            <td>{{ d['answer_follows'] }}</td>
                            <td>{{ GeneralStateValue2Str(d['answer_state']) }}</td>
                            <td>{{ d['answer_addtime'] }}</td>
                            <td></td>
                            <td>
                                <div class="dropdown">
                                    <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu{{ d['answer_id'] }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="fa fa-cogs"></i> 操作 <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" aria-labelledby="dropdownMenu{{ d['answer_id'] }}">
                                        {% if d['answer_state'] == 1 %}
                                            <li><a href="javascript:void(0)" durl="{{ url.get('question/setAnswerState') }}" did="{{ d['answer_id'] }}" dstate="-1" class="but_set_state"><i class="fa fa-trash-o fa-fw"></i> 删 除</a></li>
                                        {% endif %}
                                        {% if d['answer_state'] == -1 %}
                                            <li><a href="javascript:void(0)" durl="{{ url.get('question/setAnswerState') }}" did="{{ d['answer_id'] }}" dstate="1" class="but_set_state"><i class="fa fa-reply fa-fw"></i> 恢 复</a></li>
                                        {% endif %}
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    {% endfor %}
                </table>

                {{ this.tagNav.page(
                page,
                total,
                limit,
                url.get('question/answerList', [
                'id': id,
                'page': '__PAGE__'
                ]
                )) }}

            </div>
        </div>
    </div>

{% endblock %}